//创建对象来计数
class Sum {
private:
    static int count;
    static int sum;
public:
    Sum()
    {
        count++;
        sum += count;
    }

    static int GetSum() {
        return sum;
    }

    //每次调用完清零重置    
    static void EndSum() {
        sum = 0;
        count = 0;
    }
};
int Sum::count = 0;
int Sum::sum = 0;


class Solution {
public:
    int Sum_Solution(int n) {
        Sum::EndSum();
        Sum x[n];
        //可边长数组，vs下支持
        return Sum::GetSum();
    }
};